home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Freeware 2002 November
/
SGI Freeware 2002 November - Disc 2.iso
/
dist
/
fw_groff.idb
/
usr
/
freeware
/
info
/
groff-1.z
/
groff-1
Wrap
Text File
|
2002-04-08
|
48KB
|
1,175 lines
This is groff, produced by makeinfo version 4.0 from groff.texinfo.
INFO-DIR-SECTION Miscellaneous
START-INFO-DIR-ENTRY
* Groff: (groff). The GNU troff document formatting system.
END-INFO-DIR-ENTRY
This Info file documents GNU troff version 1.16.
Published by the Free Software Foundation 59 Temple Place, Suite 330
Boston, MA 02111-1307 USA
Copyright (C) 1994-2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
may be included in a translation approved by the Free Software
Foundation instead of in the original English.
File: groff, Node: Top, Next: Copying, Prev: (dir), Up: (dir)
This Info file documents groff version 1.16, the GNU implementation
of the troff typesetting system.
This is an in-progress document; contributions, comments, or
contributions are welcome. Send them to bug-groff@gnu.org.
* Menu:
* Copying::
* Introduction::
* Invoking groff::
* Tutorial for Macro Users::
* Macro Packages::
* gtroff Reference::
* Preprocessors::
* Output Devices::
* File formats::
* Installation::
* Request Index::
* Escape Index::
* Operator Index::
* Register Index::
* Macro Index::
* String Index::
* Glyph Name Index::
* Font File Keyword Index::
* Program and File Index::
* Concept Index::
File: groff, Node: Copying, Next: Introduction, Prev: Top, Up: Top
GNU GENERAL PUBLIC LICENSE
**************************
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111, USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Preamble
========
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software - to make sure the software is free for all its users. This
General Public License applies to most of the Free Software Foundation's
software and to any other program whose authors commit to using it.
(Some other Free Software Foundation software is covered by the GNU
Library General Public License instead.) You can apply it to your
programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it in
new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software,
and (2) offer you this license which gives you legal permission to
copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a
notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program",
below, refers to any such program or work, and a "work based on
the Program" means either the Program or any derivative work under
copyright law: that is to say, a work containing the Program or a
portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is
included without limitation in the term "modification".) Each
licensee is addressed as "you".
Activities other than copying, distribution and modification are
not covered by this License; they are outside its scope. The act
of running the Program is not restricted, and the output from the
Program is covered only if its contents constitute a work based on
the Program (independent of having been made by running the
Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep
intact all the notices that refer to this License and to the
absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange
for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a. You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b. You must cause any work that you distribute or publish, that
in whole or in part contains or is derived from the Program
or any part thereof, to be licensed as a whole at no charge
to all third parties under the terms of this License.
c. If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display
an announcement including an appropriate copyright notice and
a notice that there is no warranty (or else, saying that you
provide a warranty) and that users may redistribute the
program under these conditions, and telling the user how to
view a copy of this License. (Exception: if the Program
itself is interactive but does not normally print such an
announcement, your work based on the Program is not required
to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the
Program, and can be reasonably considered independent and separate
works in themselves, then this License, and its terms, do not
apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a
whole which is a work based on the Program, the distribution of
the whole must be on the terms of this License, whose permissions
for other licensees extend to the entire whole, and thus to each
and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or
contest your rights to work written entirely by you; rather, the
intent is to exercise the right to control the distribution of
derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the
Program with the Program (or with a work based on the Program) on
a volume of a storage or distribution medium does not bring the
other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms
of Sections 1 and 2 above provided that you also do one of the
following:
a. Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for
software interchange; or,
b. Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than
your cost of physically performing source distribution, a
complete machine-readable copy of the corresponding source
code, to be distributed under the terms of Sections 1 and 2
above on a medium customarily used for software interchange;
or,
c. Accompany it with the information you received as to the
offer to distribute corresponding source code. (This
alternative is allowed only for noncommercial distribution
and only if you received the program in object code or
executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete
source code means all the source code for all modules it contains,
plus any associated interface definition files, plus the scripts
used to control compilation and installation of the executable.
However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either
source or binary form) with the major components (compiler,
kernel, and so on) of the operating system on which the executable
runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this
License. However, parties who have received copies, or rights,
from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify
or distribute the Program or its derivative works. These actions
are prohibited by law if you do not accept this License.
Therefore, by modifying or distributing the Program (or any work
based on the Program), you indicate your acceptance of this
License to do so, and all its terms and conditions for copying,
distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program
subject to these terms and conditions. You may not impose any
further restrictions on the recipients' exercise of the rights
granted herein. You are not responsible for enforcing compliance
by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent
issues), conditions are imposed on you (whether by court order,
agreement or otherwise) that contradict the conditions of this
License, they do not excuse you from the conditions of this
License. If you cannot distribute so as to satisfy simultaneously
your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the
Program at all. For example, if a patent license would not permit
royalty-free redistribution of the Program by all those who
receive copies directly or indirectly through you, then the only
way you could satisfy both it and this License would be to refrain
entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable
under any particular circumstance, the balance of the section is
intended to apply and the section as a whole is intended to apply
in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of
any such claims; this section has the sole purpose of protecting
the integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is
willing to distribute software through any other system and a
licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed
to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces,
the original copyright holder who places the Program under this
License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only
in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of
this License.
9. The Free Software Foundation may publish revised and/or new
versions of the General Public License from time to time. Such
new versions will be similar in spirit to the present version, but
may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies a version number of this License which applies
to it and "any later version", you have the option of following
the terms and conditions either of that version or of any later
version published by the Free Software Foundation. If the Program
does not specify a version number of this License, you may choose
any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the
author to ask for permission. For software which is copyrighted
by the Free Software Foundation, write to the Free Software
Foundation; we sometimes make exceptions for this. Our decision
will be guided by the two goals of preserving the free status of
all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
=============================================
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
ONE LINE TO GIVE THE PROGRAM'S NAME AND AN IDEA OF WHAT IT DOES.
Copyright (C) 19YY NAME OF AUTHOR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
Also add information on how to contact you by electronic and paper
mail.
If the program is interactive, make it output a short notice like
this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type
`show w'. This is free software, and you are welcome to redistribute
it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and
`show c'; they could even be mouse-clicks or menu items - whatever
suits your program.
You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the program,
if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest
in the program `Gnomovision' (which makes passes at compilers)
written by James Hacker.
SIGNATURE OF TY COON, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Library General Public License instead of this License.
File: groff, Node: Introduction, Next: Invoking groff, Prev: Copying, Up: Top
Introduction
************
GNU `troff' (or `groff') is a system for typesetting documents.
`troff' is very flexible and has been in existence (and use) for about
3 decades. It is quite widespread and firmly entrenched in the UNIX
community.
* Menu:
* What Is groff?::
* History::
* groff Capabilities::
* Macro Package Intro::
* Preprocessor Intro::
* Output device intro::
* Credits::
File: groff, Node: What Is groff?, Next: History, Prev: Introduction, Up: Introduction
What Is `groff'?
================
`groff' belongs to an older generation of document preparation
systems, which operate more like compilers than the more recent
interactive WYSIWYG(1) (*note What Is groff?-Footnote-1::) systems.
`groff' and its contemporary counterpart, TeX, both work using a
"batch" paradigm: The input (or "source") files are normal text files
with embedded formatting commands. These files can then be processed
by `groff' to produce a typeset document on a variety of devices.
Likewise, `groff' should not be confused with a "word processor",
since that term connotes an integrated system that includes an editor
and a text formatter. Also, many word processors follow the WYSIWYG
paradigm discussed earlier.
Although WYSIWYG systems may be easier to use, they have a number of
disadvantages compared to `troff':
* They must be used on a graphics display to work on a document.
* Most of the WYSIWYG systems are either non-free or are not very
portable.
* `troff' is firmly entrenched in all UNIX systems.
* It is difficult to have a wide range of capabilities available
within the confines of a GUI/window system.
* It is more difficult to make global changes to a document.
"GUIs normally make it simple to accomplish simple actions and
impossible to accomplish complex actions." -Doug Gwyn (22/Jun/91
in `comp.unix.wizards')
File: groff, Node: What Is groff?-Footnotes, Up: What Is groff?
(1) What You See Is What You Get
File: groff, Node: History, Next: groff Capabilities, Prev: What Is groff?, Up: Introduction
History
=======
`troff' can trace its origins back to a formatting program called
`runoff', written by J. E. Saltzer, which ran on MIT's CTSS operating
system in the mid-sixties. This name came from the common phrase of
the time "I'll run off a document." Bob Morris ported it to the 635
architecture and called the program `roff' (an abbreviation of
`runoff'). It was rewritten as `rf' for the PDP-7 (before having
UNIX), and at the same time (1969), Doug McIllroy rewrote an extended
and simplified version of `roff' in the BCPL programming language.
The first version of UNIX was developed on a PDP-7 which was sitting
around Bell Labs. In 1971 the developers wanted to get a PDP-11 for
further work on the operating system. In order to justify the cost for
this system, they proposed that they would implement a document
formatting system for the AT&T patents division. This first formatting
program was a reimplementation of McIllroy's `roff', written by
J. F. Ossanna.
When they needed a more flexible language, a new version of `roff'
called `nroff' ("Newer `roff'") was written. It had a much more
complicated syntax, but provided the basis for all future versions.
When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a
version of `nroff' that would drive it. It was dubbed `troff', for
"typesetter `roff'", although many people have speculated that it
actually means "Times `roff'" because of the use of the Times font
family in `troff' by default. As such, the name `troff' is pronounced
`t-roff' rather than `trough'.
With `troff' came `nroff' (they were actually the same program
except for some `#ifdef's), which was for producing output for line
printers and character terminals. It understood everything `troff'
did, and ignored the commands which were not applicable (e.g. font
changes).
Since there are several things which cannot be done easily in
`troff', work on several preprocessors began. These programs would
transform certain parts of a document into `troff', which made a very
natural use of pipes in UNIX.
The `eqn' preprocessor allowed mathematical formulae to be specified
in a much simpler and more intuitive manner. `tbl' is a preprocessor
for formatting tables. The `refer' preprocessor (and the similar
program, `bib') processes citations in a document according to a
bibliographic database.
Unfortunately, Ossanna's `troff' was written in PDP-11 assembly
language and produced output specifically for the CAT phototypesetter.
He rewrote it in C, although it was now 7000 lines of uncommented code
and still dependent on the CAT. As the CAT became less common, and was
no longer supported by the manufacturer, the need to make it support
other devices became a priority. However, before this could be done,
Ossanna was killed in an auto accident.
So, Brian Kernighan took on the task of rewriting `troff'. The
newly rewritten version produced a device independent code which was
very easy for postprocessors to read and translate to the appropriate
printer codes. Also, this new version of `troff' (called `ditroff' for
"device independent `troff'") had several extensions, which included
drawing functions.
Due to the additional abilities of the new version of `troff',
several new preprocessors appeared. The `pic' preprocessor provides a
wide range of drawing functions. Likewise the `ideal' preprocessor did
the same, although via a much different paradigm. The `grap'
preprocessor took specifications for graphs, but, unlike other
preprocessors, produced `pic' code.
James Clark began work on a GNU implementation of `ditroff' in
early 1989. The first version, `groff' 0.3.1, was released June 1990.
`groff' included:
* A replacement for `ditroff' with many extensions.
* The `soelim', `pic', `tbl', and `eqn' preprocessors.
* Postprocessors for character devices, POSTSCRIPT, TeX DVI, and
X windows. GNU `troff' also eliminated the need for a separate
`nroff' program with a postprocessor which would produce ASCII
output.
* A version of the `me' macros and an implementation of the `man'
macros.
Also, a front-end was included which could construct the, sometimes
painfully long, pipelines required for all the post- and preprocessors.
Development of GNU `troff' progressed rapidly, and saw the additions
of a replacement for `refer', an implementation of the `ms' and `mm'
macros, and a program to deduce how to format a document (`grog').
It was declared a stable (i.e. non-beta) package with the release of
version 1.04 around November 1991.
Beginning in 1999, `groff' has new maintainers (the package was an
orphan for a few years). As a result, new features and programs like
`grn', a preprocessor for gremlin images, and an output device to
produce HTML output have been added.
File: groff, Node: groff Capabilities, Next: Macro Package Intro, Prev: History, Up: Introduction
`groff' Capabilities
====================
So what exactly is `groff' capable of doing? `groff' provides a
wide range of low-level text formatting operations. Using these, it is
possible to perform a wide range of formatting tasks, such as
footnotes, table of contents, multiple columns, etc. Here's a list of
the most important operations supported by `groff':
* text filling, adjusting, and centering
* hyphenation
* page control
* font and character size control
* vertical spacing (i.e. double spacing)
* line length and indenting
* macros, strings, diversions, and traps
* number registers
* tabs, leaders, and fields
* input and output conventions and character translation
* overstrike, bracket, line drawing, and zero-width functions
* local horizontal and vertical motions and the width function
* three-part titles
* output line numbering
* conditional acceptance of input
* environment switching
* insertions from the standard input
* input/output file switching
* output and error messages
File: groff, Node: Macro Package Intro, Next: Preprocessor Intro, Prev: groff Capabilities, Up: Introduction
Macro Packages
==============
Since `groff' provides such low-level facilities, it can be quite
difficult to use by itself. However, `groff' provides a "macro"
facility to specify how certain routine operations (e.g. starting
paragraphs, printing headers and footers, etc.) should be done. These
macros can be collected together into a "macro package". There are a
number of macro packages available; the most common (and the ones
described in this manual) are `man', `mdoc', `me', `ms', and `mm'.
File: groff, Node: Preprocessor Intro, Next: Output device intro, Prev: Macro Package Intro, Up: Introduction
Preprocessors
=============
Although `groff' provides most functions needed to format a
document, some operations would be unwieldy (e.g. to draw pictures).
Therefore, programs called preprocessors were written which understand
their own language and produce the necessary `groff' operations. These
preprocessors are able to differentiate their own input from the rest
of the document via markers.
To use a preprocessor, UNIX pipes are used to feed the output from
the preprocessor into `groff'. Any number of preprocessors may be used
on a given document; in this case, the preprocessors are linked
together into one pipeline. However, in `groff', the user does not
need to construct the pipe, but only tell `groff' what preprocessors to
use.
`groff' currently has preprocessors for producing tables (`tbl'),
typesetting equations (`eqn'), drawing pictures (`pic' and `grn'), and
for processing bibliographies (`refer'). An associated program which
is useful when dealing with preprocessors is `soelim'.
A free implementation of `grap', a preprocessor for drawing graphs,
can be obtained as an extra package; `groff' can use `grap' also.
There are other preprocessors in existence, but, unfortunately, no
free implementations are available. Among them are preprocessors for
drawing mathematical pictures (`ideal') and chemical structures
(`chem').
File: groff, Node: Output device intro, Next: Credits, Prev: Preprocessor Intro, Up: Introduction
Output Devices
==============
`groff' actually produces device independent code which may be fed
into a postprocessor to produce output for a particular device.
Currently, `groff' has postprocessors for POSTSCRIPT devices, character
terminals, X Windows (for previewing), TeX DVI format, HP LaserJet 4
and Canon LBP printers (which use CAPSL), and HTML.
File: groff, Node: Credits, Prev: Output device intro, Up: Introduction
Credits
=======
Large portions of this manual were taken from existing documents,
most notably, the manual pages for the `groff' package by James Clark,
and Eric Allman's papers on the `me' macro package.
The section on the `man' macro package is partly based on Susan G.
Kleinmann's `groff_man' manual page written for the Debian GNU/Linux
system.
File: groff, Node: Invoking groff, Next: Tutorial for Macro Users, Prev: Introduction, Up: Top
Invoking `groff'
****************
This section focuses on how to invoke the `groff' front end. This
front end takes care of the details of constructing the pipeline among
the preprocessors, `gtroff' and the postprocessor.
It has become a tradition that GNU programs get the prefix `g' to
distinguish it from its original counterparts provided by the host (see
*Note Environment::, for more details). Thus, for example, `geqn' is
GNU `eqn'. On operating systems like Linux or the Hurd, which don't
contain proprietary software, and on MS-DOS/MS-Windows, where `troff'
and associated programs are not available at all, this prefix is
omitted since GNU `troff' is the only used incarnation of `troff'.
Exception: `groff' is never replaced by `roff'.
* Menu:
* Groff Options::
* Environment::
* Invocation Examples::
File: groff, Node: Groff Options, Next: Environment, Prev: Invoking groff, Up: Invoking groff
Options
=======
`groff' normally runs the `gtroff' program and a postprocessor
appropriate for the selected device. The default device is `ps' (but
it can be changed when `groff' is configured and built). It can
optionally preprocess with any of `gpic', `geqn', `gtbl', `ggrn',
`grap', `grefer', or `gsoelim'.
This section only documents options to the `groff' front end. Many
of the arguments to `groff' are passed on to `gtroff', therefore those
are also included. Arguments to pre- or postprocessors can be found in
*Note Invoking gpic::, *Note Invoking geqn::, *Note Invoking gtbl::,
*Note Invoking ggrn::, *Note Invoking grefer::, *Note Invoking
gsoelim::, *Note Invoking grotty::, *Note Invoking grops::, *Note
Invoking grohtml::, *Note Invoking grodvi::, *Note Invoking grolj4::,
*Note Invoking grolbp::, and *Note Invoking gxditview::.
The command line format for `groff' is:
groff [ -abeghilpstvzCEGNRSUVXZ ] [ -FDIR ] [ -mNAME ]
[ -TDEF ] [ -fFAM ] [ -wNAME ] [ -WNAME ]
[ -MDIR ] [ -dCS ] [ -rCN ] [ -nNUM ]
[ -oLIST ] [ -PARG ] [ -LARG ] [ -IDIR ]
[ FILES... ]
The command line format for `gtroff' is as follows.
gtroff [ -abivzCERU ] [ -wNAME ] [ -WNAME ] [ -dCS ]
[ -fFAM ] [ -mNAME ] [ -nNUM ]
[ -oLIST ] [ -rCN ] [ -TNAME ]
[ -FDIR ] [ -MDIR ] [ FILES... ]
Obviously, many of the options to `groff' are actually passed on to
`gtroff'.
Options without an argument can be grouped behind a single `-'. A
filename of `-' denotes the standard input. It is possible to have
whitespace between an option and its parameter.
The `grog' command can be used to guess the correct `groff' command
to format a file.
Here's the description of the command-line options:
`-h'
Print a help message.
`-e'
Preprocess with `geqn'.
`-t'
Preprocess with `gtbl'.
`-g'
Preprocess with `ggrn'.
`-G'
Preprocess with `grap'.
`-p'
Preprocess with `gpic'.
`-s'
Preprocess with `gsoelim'.
`-R'
Preprocess with `grefer'. No mechanism is provided for passing
arguments to `grefer' because most `grefer' options have
equivalent commands which can be included in the file. *Note
grefer::, for more details.
Note that `gtroff' also accepts a `-R' option, which is not
accessible via `groff'. This option prevents the loading of the
`troffrc' and `troffrc-end' files.
`-v'
Make programs run by `groff' print out their version number.
`-V'
Print the pipeline on `stdout' instead of executing it.
`-z'
Suppress output from `gtroff'. Only error messages are printed.
`-Z'
Do not postprocess the output of `gtroff'. Normally `groff'
automatically runs the appropriate postprocessor.
`-PARG'
Pass ARG to the postprocessor. Each argument should be passed
with a separate `-P' option. Note that `groff' does not prepend
`-' to ARG before passing it to the postprocessor.
`-l'
Send the output to a spooler for printing. The command used for
this is specified by the `print' command in the device description
file (see *Note Font Files::, for more info). If not present,
`-l' is ignored.
`-LARG'
Pass ARG to the spooler. Each argument should be passed with a
separate `-L' option. Note that `groff' does not prepend a `-' to
ARG before passing it to the postprocessor. If the `print'
keyword in the device description file is missing, `-L' is ignored.
`-TDEV'
Prepare output for device DEV. The default device is `ps', unless
changed when `groff' was configured and built. The following are
the output devices currently available:
`ps'
For POSTSCRIPT printers and previewers.
`dvi'
For TeX DVI format.
`X75'
For a 75dpi X11 previewer.
`X100'
For a 100dpi X11 previewer.
`ascii'
For typewriter-like devices.
`latin1'
For typewriter-like devices that support the Latin-1
(ISO 8859-1) character set.
`utf8'
For typewriter-like devices which use the Unicode (ISO 10646)
character set with UTF-8 encoding.
`cp1047'
For typewriter-like devices which use the EBCDIC encoding IBM
cp1047.
`lj4'
For an HP LaserJet4-compatible (or other PCL5-compatible)
printer.
`lbp'
For Canon CAPSL printers (LBP-4 and LBP-8 series laser
printers).
`html'
To produce HTML output. Note that the HTML driver consists
of two parts, a preprocessor (`pre-grohtml') and a
postprocessor (`post-grohtml').
The predefined `gtroff' string register `.T' contains the current
output device; the read-only number register `.T' is set to 1 if
this option is used (which is always true if `groff' is used to
call `gtroff'). *Note Built-in Registers::.
The postprocessor to be used for a device is specified by the
`postpro' command in the device description file. (*Note Font
Files::, for more info.) This can be overridden with the `-X'
option.
`-X'
Preview with `gxditview' instead of using the usual postprocessor.
This is unlikely to produce good results except with `-Tps'.
Note that this is not the same as using `-TX75' or `-TX100' to
view a document with `gxditview': The former uses the metrics of
the specified device, whereas the latter uses X-specific fonts and
metrics.
`-N'
Don't allow newlines with `eqn' delimiters. This is the same as
the `-N' option in `geqn'.
`-S'
Safer mode. Pass the `-S' option to `gpic' and disable the
`open', `opena', `pso', `sy', and `pi' requests. For security
reasons, this is enabled by default.
`-U'
Unsafe mode. Reverts to the old unsafe behaviour.
`-a'
Generate an ASCII approximation of the typeset output. The
read-only register `.A' is then set to 1. *Note Built-in
Registers::. A typical example is
groff -a -man -Tdvi troff.man | less
which shows how lines are broken for the DVI device. Note that
this option is rather useless today since graphic output devices
are available virtually everywhere.
`-b'
Print a backtrace with each warning or error message. This
backtrace should help track down the cause of the error. The line
numbers given in the backtrace may not always be correct: `gtroff'
can get confused by `as' or `am' requests while counting line
numbers.
`-i'
Read the standard input after all the named input files have been
processed.
`-wNAME'
Enable warning NAME. Available warnings are described in *Note
Debugging::. Multiple `-w' options are allowed.
`-WNAME'
Inhibit warning NAME. Multiple `-W' options are allowed.
`-E'
Inhibit all error messages.
`-C'
Enable compatibility mode. *Note Implementation Differences::,
for the list of incompatibilities between `groff' and traditional
Unix `troff'.
`-dCS'
`-dNAME=s'
Define C or NAME to be a string S. C must be a one-letter name;
NAME can be of arbitrary length. All string assignments happen
before loading any macro file (including the start-up file).
`-fFAM'
Use FAM as the default font family. *Note Font Families::.
`-mNAME'
Read in the file `NAME.tmac'. Normally `groff' searches for this
in its macro directories. If it isn't found, it tries `tmac.NAME'
(and searches in the same directories).
`-nNUM'
Number the first page NUM.
`-oLIST'
Output only pages in LIST, which is a comma-separated list of page
ranges; `N' means print page N, `M-N' means print every page
between M and N, `-N' means print every page up to N, `N-' means
print every page beginning with N. `gtroff' exits after printing
the last page in the list. All the ranges are inclusive on both
ends.
Within `gtroff', this information can be extracted with the `.P'
register. *Note Built-in Registers::.
If your document restarts page numbering at the beginning of each
chapter, then `gtroff' prints the specified page range for each
chapter.
`-rCN'
`-rNAME=N'
Set number register C or NAME to the value N. C must be a
one-letter name; NAME can be of arbitrary length. N can be any
`gtroff' numeric expression. All register assignments happen
before loading any macro file (including the start-up file).
`-FDIR'
Search `DIR' for subdirectories `devNAME' (NAME is the name of the
device), for the `DESC' file, and for font files before looking in
the standard directories.
`-MDIR'
Search directory `DIR' for macro files before the standard
directories.
`-IDIR'
This option is as described in *Note gsoelim::. It implies the
`-s' option.
File: groff, Node: Environment, Next: Invocation Examples, Prev: Groff Options, Up: Invoking groff
Environment
===========
There are also several environment variables (of the operating
system, not within `gtroff') which can modify the behavior of `groff'.
`GROFF_COMMAND_PREFIX'
If this is set to X, then `groff' runs `Xtroff' instead of
`gtroff'. This also applies to `tbl', `pic', `eqn', `grn',
`refer', and `soelim'. It does not apply to `grops', `grodvi',
`grotty', `pre-grohtml', `post-grohtml', `grolj4', and `gxditview'.
`GROFF_TMAC_PATH'
A colon-separated list of directories in which to search for macro
files (before the default directories are tried).
`GROFF_TYPESETTER'
The default output device.
`GROFF_FONT_PATH'
A colon-separated list of directories in which to search for the
`dev'NAME directory (before the default directories are tried).
`GROFF_BIN_PATH'
This search path, followed by `PATH', is used for commands executed
by `groff'.
`GROFF_TMPDIR'
The directory in which `groff' creates temporary files. If this is
not set and `TMPDIR' is set, temporary files are created in that
directory. Otherwise temporary files are created in a
system-dependent default directory (on Unix and GNU/Linux systems,
this is usually `/tmp'). `grops', `grefer', `pre-grohtml', and
`post-grohtml' can create temporary files in this directory.
Note that MS-DOS and MS-Windows ports of `groff' use semi-colons,
rather than colons, to separate the directories in the lists described
above.
File: groff, Node: Invocation Examples, Prev: Environment, Up: Invoking groff
Invocation Examples
===================
This section lists several common uses of `groff' and the
corresponding command lines.
groff file
This command processes `file' without a macro package or a
preprocessor. The output device is the default, `ps', and the output
is sent to `stdout'.
groff -t -mandoc -Tascii file | less
This is basically what a call to the `man' program does. `gtroff'
processes the manual page `file' with the `mandoc' macro file (which in
turn either calls the `man' or the `mdoc' macro package), using the
`tbl' preprocessor and the ASCII output device. Finally, the `less'
pager displays the result.
groff -X -m me file
Preview `file' with `gxditview', using the `me' macro package. Since
no `-T' option is specified, use the default device (`ps'). Note that
you can either say `-m me' or `-me'; the latter is an anachronism from
the early days of UNIX.(1) (*note Invocation Examples-Footnote-1::)
groff -man -rD1 -z file
Check `file' with the `man' macro package, forcing double-sided
printing - don't produce any output.
* Menu:
* grog::
File: groff, Node: Invocation Examples-Footnotes, Up: Invocation Examples
(1) The same is true for the other main macro packages that come
with `groff': `man', `mdoc', `ms', `mm', and `mandoc'. This won't work
in general; for example, to load `trace.tmac', either `-mtrace' or
`-m trace' must be used.
File: groff, Node: grog, Prev: Invocation Examples, Up: Invocation Examples
`grog'
------
`grog' reads files, guesses which of the `groff' preprocessors
and/or macro packages are required for formatting them, and prints the
`groff' command including those options on the standard output. It
generates one or more of the options `-e', `-man', `-me', `-mm', `-ms',
`-mdoc', `-mdoc-old', `-p', `-R', `-g', `-G', `-s', and `-t'.
A special file name `-' refers to the standard input. Specifying no
files also means to read the standard input. Any specified options are
included in the printed command. No space is allowed between options
and their arguments. The only options recognized are `-C' (which is
also passed on) to enable compatibility mode, and `-v' (if it is the
only parameter) to print the version number.
For example,
grog -Tdvi paper.ms
guesses the appropriate command to print `paper.ms' and then prints it
to the command line after adding the `-Tdvi' option. For direct
execution, enclose the call to `grog' in backquotes at the UNIX shell
prompt:
`grog -Tdvi paper.ms` > paper.dvi
As seen in the example, it is still necessary to redirect the output to
something meaningful (i.e. either a file or a pager program like
`less').
File: groff, Node: Tutorial for Macro Users, Next: Macro Packages, Prev: Invoking groff, Up: Top
Tutorial for Macro Users
************************
Most users tend to use a macro package to format their papers. This
means that the whole breadth of `groff' is not necessary for most
people. This chapter covers the material needed to efficiently use a
macro package.
* Menu:
* Basics::
* Common Features::